package com.wangsd.web.coupon.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wangsd.web.coupon.entity.IntegralDetail;
import com.wangsd.web.coupon.mapper.IntegralDetailMapper;
import com.wangsd.web.coupon.service.IntegralDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author generator
 * @since 2019-10-11
 */
@Service
public class IntegralDetailServiceImpl extends ServiceImpl<IntegralDetailMapper, IntegralDetail> implements IntegralDetailService {

    @Autowired
    IntegralDetailMapper integralDetailMapper;

    @Override
    public IPage<IntegralDetail> selectPage(String openid, Integer pageNum, Integer pageSize) {
        Page<IntegralDetail> page = new Page<>(pageNum, pageSize);
        QueryWrapper<IntegralDetail> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("open_id",openid);
        queryWrapper.orderByDesc("created_time");
        IPage<IntegralDetail> productIPage = integralDetailMapper.selectPage(page,queryWrapper);
        return productIPage;
    }
}
